from django.db import models
from utils.utils import primaryKey


# 租户
class Tenant(models.Model):
    id = models.BigAutoField(primary_key=True, default=primaryKey)
    code = models.CharField(unique=True, max_length=12, verbose_name="租户号")
    tenantName = models.CharField(max_length=50, db_column="tenant_name", verbose_name="租户名")
    linkman = models.CharField(max_length=20, null=True, blank=True, verbose_name="联系人")
    phone = models.CharField(max_length=20, null=True, blank=True, verbose_name="手机号")
    address = models.CharField(max_length=255, null=True, blank=True, verbose_name="地址")
    expireTime = models.DateTimeField(null=True, blank=True, db_column="expire_time", verbose_name="过期时间")
    status = models.PositiveSmallIntegerField(default=0, null=True, blank=True, verbose_name="状态")
    
    class Meta:
        db_table = 'system_tenant'
        ordering = ['-expireTime']

    def __str__(self):
        return self.tenantName
